package com.bcxj.internalcommon.util;

/**
 * ClassName: RedisPrefixUtils
 * Package: com.bcxj.internalcommon.util
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/9/24 22:50
 * @Version 1.0
 * @Since 1.0
 */
public class RedisPrefixUtils {
    public static final String TOKEN_PREFIX = "token:";

    private static final String verificationCodePrefix = "verfication-code-";

    public static final String blackDeviceCodePrefix = "black-device-";


    /**
     * 根据已有的信息生成tokenKey
     * @param phone
     * @param identity
     * @param tokenType
     * @return
     */
    public static String generatorTokenKey(String phone, String identity, String tokenType) {
        return TOKEN_PREFIX + phone + "-" + identity + "-" + tokenType;
    }

    /**
     * 生成Redis的手机验证码key
     * @param phone
     * @param identity
     * @return
     */
    public static String generatorKeyByPhone(String phone, String identity) {
        return verificationCodePrefix + identity + "-" + phone;
    }
}
